package com.runchinaup.smartbelt.domian;

/**
 * Created by liber on 2018/2/1.
 */

public class BleData extends BaseData {

    //设置的头
    private byte contollOne = (byte) 0xa1;
    private byte contollTwo = 0x5a;
    private byte contollThree = 0x09;
    private byte contollFour = 0x01;

    //发送数据
    private byte modelData = 3;         //模式
    private byte strongData = 1;        //强度
    private byte timeData = 1;          //时长
    private byte acTimeData = 1;        //默认时长
    private boolean openClose = false;  //打开或者关闭

    public byte getContollOne() {
        return contollOne;
    }

    public byte getContollTwo() {
        return contollTwo;
    }

    public byte getContollThree() {
        return contollThree;
    }

    public byte getContollFour() {
        return contollFour;
    }

    public byte getModelData() {
        return modelData;
    }

    public void setModelData(byte modelData) {
        this.modelData = modelData;
    }

    public byte getStrongData() {
        return strongData;
    }

    public void setStrongData(byte strongData) {
        this.strongData = strongData;
    }

    public byte getTimeData() {
        return timeData;
    }

    public void setTimeData(byte timeData) {
        this.timeData = timeData;
    }

    public byte getAcTimeData() {
        return acTimeData;
    }

    public void setAcTimeData(byte acTimeData) {
        this.acTimeData = acTimeData;
    }

    public boolean isOpenClose() {
        return openClose;
    }

    public void setOpenClose(boolean openClose) {
        this.openClose = openClose;
    }


    public byte[] packData() {
        byte[] result = new byte[]{
                contollOne,
                contollTwo,
                contollThree,
                contollFour,
                (byte) (openClose ? 1 : 0),
                modelData,
                strongData,
                timeData,
                acTimeData,
                0
        };
        result[result.length - 1] = CountCheckCode(result);
        return result;
    }

}
